<template>
	<view>
		<form class="" @submit="formsubmit" @reset="formreset">
			<view class="xb-page">
				<view class="xb-page-section-title">基本信息</view>
				<view class="xb-form-cell">
					<view class="xb-form-cell-row">
						<view class="xb-form-cell-title xb-form-cell-grow1">班级名</view>
						<view class="xb-form-cell-grow1">
						<input v-model="formdata.name" class="xb-input " placeholder-class="xb-input-placeholder" 
						 placeholder="请输入班级名称" />
						 </view>
					</view>
				</view> 
				<view class="xb-form-cell">
					<view class="xb-form-cell-row">
						<view class="xb-form-cell-title xb-form-cell-grow1">课程</view>
						<picker class="xb-select xb-form-cell-grow1" v-model="formdata.sid" :range="subjectList" mode="selector">请选择科目</picker>
					</view>
				</view>
				<view class="xb-form-cell">
					<view class="xb-form-cell-row">
						<view class="xb-form-cell-title xb-form-cell-grow1 ">教室</view>
						<picker class="xb-select xb-form-cell-grow1"  v-model="formdata.rid" :range="roomList" mode="selector">请选择教室</picker>
					</view>
				</view>
				<view class="xb-form-cell">
					<view class="xb-form-cell-row">
						<view class="xb-form-cell-title xb-form-cell-grow1">上限</view>
						<input class="uni-input xb-form-cell-grow1" placeholder-class="xb-input-placeholder" maxlength="10" placeholder="人数上限" />
					</view>
				</view>
				<view class="xb-form-cell">
					<view class="xb-form-cell-row">
						<view class="xb-form-cell-title xb-form-cell-grow1">班主任</view>
						<picker class="xb-select xb-form-cell-grow1" :range="empList" mode="selector">请选择班主任</picker>
					</view>
				</view>
				<view class="xb-form-cell">
					<view class="xb-form-cell-row">
						<view class="xb-form-cell-title">备注</view>
						<textarea class="xb-textarea" maxlength="100"  placeholder-class="xb-input-placeholder" placeholder="请输入班级备注"></textarea>
					</view>
				</view>
			</view>
			<view>
				<button form-type="submit"></button>
			</view>
		</form>
	</view>
</template>

<script>
	import {
		mapActions,
		mapState,
		mapGetters
	} from 'vuex'
	export default {
		computed: {
			...mapGetters(['subjectList', 'roomList', 'empList'])
		},
		data() {
			return {
				formdata: {
					name: '',
					subject: '',
					maxnum: 0,
					empname: '',
					comments: '',

				}

			}
		},
		methods: {
			async formsubmit() {
				const res = await createcls(this.formdata)
				if (res.success == true) {
					console.info('创建成功!')
					uni.navigateBack({
						delta: 1
					})
				} else {

				}

			}
		}

	}
</script>


<style scoped >
	@import "../../../common/uni.css";
	@import "../../../common/xb.css";

	.comments-area {
		height: 50px;
	}

	.textare {
		height: 102px;
	}

	textarea {
		width: 700px;
		padding: 25px 0;
		height: 80px;
		line-height: 34px;
		font-size: 32px;
	}

	.class_bottom_input_line {
		border-color: #333333;
		border-top-width: 0px;
		border-right-width: 0px;
		border-left-width: 0px;
		border-bottom-width: 1px;
	}
</style>
